import 'package:flutter/material.dart';

///获取全局的Context
class GlobalContext {
  static late BuildContext _mContext;

  static final GlobalKey<NavigatorState> navigatorKey =
      GlobalKey<NavigatorState>();

  static void setContext(context) {
    _mContext = context;
  }

  static BuildContext getContext() {
    BuildContext? _context = navigatorKey.currentState?.context;
    if (_context != null) {
      return _context;
    }
    return _mContext;
  }
}
